@extends('common.admin-master')

@section('html-body')
    <div class="content">

        <div class="header">
            <div class="stats">
                <p class="stat"><a href="{{route('Admin')}}">返回首页</a></p>
            </div>
            <h1 class="page-title">审核管理</h1>
        </div>


        <div class="container-fluid">
            <div class="row-fluid">

                <div class="row-fluid">
                    <div class="block span12">
                        <a href="#tablewidget" class="block-heading" data-toggle="collapse">审核项目列表<span class="label
                        label-warning">+{{count($projects)}}</span></a>
                        <div id="tablewidget" class="block-body collapse in">
                            <table class="table">
                            <thead>
                            <tr>
                                <th width="15%">项目名</th>
                                <th width="10%">创始人</th>
                                <th width="15%">领域</th>
                                <th width="15%">阶段</th>
                                <th width="15%">时间</th>
                                <th width="20%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if($projects)
                                @foreach($projects as $project)
                                    <tr>
                                        <td>{{$project->project_name}}</td>
                                        <td>
                                            @if($project->toUser)
                                                @if($project->toUser->userInfo)
                                                    {{$project->toUser->userInfo->realname}}
                                                @endif
                                            @else
                                                暂无数据
                                            @endif
                                        </td>
                                        <td>
                                            @if($fields = $project->project_x_fields)
                                                @foreach($fields as $field)
                                                    @if($field)
                                                        <em>{{$field->field}}</em>
                                                    @else
                                                        <em>暂无数据</em>
                                                    @endif
                                                @endforeach
                                            @else
                                                暂无数据
                                            @endif
                                        </td>
                                        <td>
                                            @if($project->toPhase)
                                                {{$project->toPhase->phase}}
                                            @else
                                                暂无数据
                                            @endif
                                        </td>
                                        <td>
                                        @if($project->create_time)
                                            {{date('Y-m',strtotime($project->create_time))}}
                                        @else
                                            {{date('Y-m',strtotime($project->created_at))}}
                                        @endif
                                        </td>
                                        @if($project->project_auth == 1)
                                            <td class="success">审核通过</td>
                                        @elseif($project->project_auth == -2)
                                            <td class="warning">审核未通过</td>
                                        @else
                                            <td>
                                                <button type="button" class="btn btn-info pro_over" data="{{$project->id}}">审核通过</button>
                                                <button type="button" class="btn pro_out" data="{{$project->id}}">审核未通过</button>
                                            </td>
                                        @endif

                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                            </table>
                        </div>
                        <div class="pagination">
                            <ul>
                                {!! $projects->render() !!}
                            </ul>
                        </div>
        </div>
    </div>

    <script>
        var CheckOverProject    = "{{route('Api.Admin.CheckOverProject' ,['auth'=>1])}}";
        var CheckOutProject    = "{{route('Api.Admin.CheckOutProject' ,['auth'=>-2])}}";
    </script>
    <script src="{{url('/js/admin/check.js')}}"></script>

    <script type="text/javascript">
        $("[rel=tooltip]").tooltip();
        $(function() {
            $('.demo-cancel-click').click(function(){return false;});
        });

        $('#nav_tab a').click(function (e) {
            e.preventDefault();
            $(this).tab('show');
        })

    </script>

@endsection


